$(function () {
    $("#btn-tologin").on("click", function () {
        let obj = $(this);
        window.location.href = "/index/tologin";
    });

    $('#btn-logout').on("click", function () {
        let obj = $(this);
        window.location.href = "/index/logOut";
    });

    $('#btn-reg').on("click", function () {
        let obj = $(this);
        window.location.href = "/index/toreg";
    });

    $('#btn-login').on("click", function () {
        let obj = $(this);
        if (obj.attr("loginUser") != null) {
            alert("请注销后登录，不要重复登录哦");
        } else {
            $("#login-form").submit();
        }
    })

    // 点击头像，新窗口中展示
    $("#bloggerImage").on("click", function () {
        let src = $(this).attr("src");
        window.open(src);
    })

    $('#backButton').on("click", function () {
        if (referer !== undefined && "" !== referer && "null" !== referer
            && referer.length > 4) {
            window.location.href = referer;
        } else {
            history.back(-1);
        }
    });

})